// loginController
angular.module("loginApp").controller('loginController', function($scope, $http) {
    $scope.login = function() {
        $scope.user.remember_me = $scope.signStatic;
        $http.post(URL_PRIFIX.uc + "/login/", $scope.user).success(function(data, status) {
            if (data.state) {
                window.location.href = "/";
            } else {
                if (data.msg == "登录密码错误！") {
                    $scope.password_error = data.msg;
                } else {
                    $scope.user_name_error = data.msg;
                }
            }

        }).error(function(data, status) {
            alert('服务器错误：' + status);
        });
    };
});

// IndexController
angular.module('mainApp').controller('IndexController', ['$scope', 'IndexService', function($scope, IndexService){
    IndexService.menu().success(function (res) {
        $scope.navigation = res.navigation;
    });

    $scope.currentMenu = function(index) {
        $scope.menuIndex = index;
    };
}]);